<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-06-28 19:27:52
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-06-28 19:36:38
 * @FilePath: \geyao\第八十七题 继承.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>继承</title>
</head>

<body>
  <!-- 请补全JavaScript代码，完成类的继承。要求如下：
1. "Chinese"类继承于"Human"类
2. "Human"类实现一个函数"getName"，返回该实例的"name"属性
3. "Chinese"类构造函数有两个参数，分别为"name"、"age"
4. "Chinese"类实现一个函数"getAge"，返回该实例的"age"属性 -->
  <script type="text/javascript">
    class Human {
    constructor(name) {
        this.name = name
        this.kingdom = 'animal'
        this.color = ['yellow', 'white', 'brown', 'black']
    }
    getName() {
        return  this.name
    }
}
class Chinese extends Human{
    constructor(name,age) {
        super(name)
        this.age = age
    }
    getAge() {
        return this.age
    }
}
  </script>
</body>

</html>